A circular dependency occurs when Provider A depends on Provider B and Provider B depends on Provider A, directly or through a chain. NestJS cannot decide which to instantiate first and throws an error at startup stating that a module or provider at a specific index is undefined.
Circular dependencies can exist at two levels: between providers (two services injecting each other) or between modules (two modules importing each other). Both cause the same class of startup error.
Startup error: 'Cannot read properties of undefined' in NestJS bootstrap.
Error message mentioning 'circular dependency' in the module or provider graph.
Provider at a specific index resolves to undefined during module scan.
The cycle can span multiple hops: A depends on B, B depends on C, C depends on A.